import http from '@/http/http'
import { ApiListParam, ApiModel, ApiParam, RequestMethod } from './ApiModel'

enum Api {
    getApiList = '/api/v1/api/getList',
    addAndEditAndDel = '/api/v1/api/api',
    parent = '/api/v1/api/parent'
}

// api列表
export const getApiListApi = async (param: ApiListParam) => {
    return await http.get(Api.getApiList, param)
}
// 新增api
export const addApiApi = async (param: ApiModel) => {
    return await http.post(Api.addAndEditAndDel, param)
}
// 编辑api
export const editApiApi = async (param: ApiModel) => {
    return await http.put(Api.addAndEditAndDel, param)
}
// 删除api
export const delApiApi = async (param: ApiParam) => {
    return await http.delete(Api.addAndEditAndDel, param)
}

// 根菜单
export const getParentTreeApi = async () => {
    return await http.get(Api.parent)
}
